Skip to content

Add IoT asset detail and sensor lookup tools#450

Merged
ShuxinLin merged 8 commits into
mainfrom
add-iot-measured-sensors
Jul 14, 2026
Merged

Add IoT asset detail and sensor lookup tools#450
ShuxinLin merged 8 commits into
mainfrom
add-iot-measured-sensors

Conversation

@ShuxinLin

@ShuxinLin ShuxinLin commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • rename the IoT asset registry detail tool from get_asset_detail(site_name, asset_id) to asset_detail(site_name, asset_id)
  • add find_assets_by_sensors(site_name, sensors, match="all", substring=false, source="measured") to find site-registered assets by installed registry sensors or measured telemetry fields
  • add structured FindAssetsResult / AssetSensorMatch responses with the deduplicated query sensors and concrete matched sensor names per asset
  • preserve existing registry/telemetry separation: asset_detail, assets, and installed_sensors read from asset_db; measured_sensors and find_assets_by_sensors(source="measured") read telemetry fields from iot_db
  • deduplicate repeated sensor query terms before match="all" evaluation while preserving first occurrence order
  • update README, MCP server docs, and tool docstrings to describe the current IoT tool surface and find_assets_by_sensors behavior
  • add unit coverage for tool registration, renamed asset_detail, installed/measured sensor source behavior, substring matching, and duplicate query sensor handling

Tool Surface

  • sites() -> {"sites": [...]}
  • asset_ids(site_name) -> bare asset id list for the site
  • asset_detail(site_name, asset_id) -> asset registry details: site_name, asset_id, description, assettype, status, location, installdate, vintage, n_installed_sensors, message
  • assets(site_name, assettype?) -> asset metadata rows: asset_id, description, assettype, vintage, n_sensors
  • installed_sensors(site_name, asset_id) -> registry sensor inventory for an asset from asset_db
  • measured_sensors(site_name, asset_id) -> observed telemetry field names for an asset from iot_db
  • find_assets_by_sensors(site_name, sensors, match?, substring?, source?) -> assets whose installed or measured sensors match the query

find_assets_by_sensors Behavior

  • source="installed" searches each asset record's registry sensors inventory
  • source="measured" searches telemetry field names discovered from IoT records
  • match="all" requires every deduplicated query sensor to match
  • match="any" requires at least one deduplicated query sensor to match
  • substring=true performs case-insensitive substring matching
  • duplicate query sensors are collapsed in query_sensors and do not cause false negatives for match="all"

Tests

  • uv run --frozen pytest src/servers/iot/tests/test_tools.py (31 passed)
  • /tmp/aob_find_assets_by_sensors_smoke.py real-db smoke via PYTHONPATH=src uv run --frozen python /tmp/aob_find_assets_by_sensors_smoke.py
    • installed exact and substring searches returned expected assets
    • duplicate query search returned deduped query_sensors
    • measured exact and substring searches returned expected assets
    • invalid match, invalid source, empty sensors, and no-match cases returned expected responses

Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin ShuxinLin changed the title Add IoT measured_sensors tool Add IoT sensor inventory tools Jul 14, 2026
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin ShuxinLin changed the title Add IoT sensor inventory tools Add IoT asset detail and sensor inventory tools Jul 14, 2026
@ShuxinLin ShuxinLin requested a review from DhavalRepo18 July 14, 2026 20:44
@ShuxinLin ShuxinLin changed the title Add IoT asset detail and sensor inventory tools Add IoT asset detail and sensor lookup tools Jul 14, 2026

@DhavalRepo18 DhavalRepo18 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said, once all code is in place i will make a fine pass on consistency check.

Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin ShuxinLin merged commit 1834e74 into main Jul 14, 2026
5 checks passed
@ShuxinLin ShuxinLin deleted the add-iot-measured-sensors branch July 14, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants